'use strict';
angular.module('app')
.controller('loginCtrl',['cache','$http','$scope','$state',function(cache,$http,$scope,$state){
  $scope.submit = function() {
    $http.get('data/login.json',$scope.user).then(function(resp){
      cache.put('id',resp.data.id);
      cache.put('name',resp.data.name);
      cache.put('image',resp.data.image);
      $state.go('main');
    });
  };
}]);
